import 'dart:convert';

import 'package:flutter_des/flutter_des.dart';

import '../public.dart';

class RulesService {
  static Future<List<Rule>> findAll() async {
    String param = await FlutterDes.encryptToHex(
        "&cmcc=10086&cu=10010", AppConfig.cryptKey,
        iv: AppConfig.cryptIv);
    String url = AppConfig.BASE_UEL + Api.findAllRules + param.toString();
    List<Rule> rules = [];
    BaseResp res = await HttpManager().request(url, method: "post");
    Map<String, dynamic> jsonObject = jsonDecode(res.data);
    rules = Rule.listFromJson(jsonObject);
    return rules;
  }
}
